package jscinttools.scint.models;

import java.io.Serializable;
import jscinttools.scint.models.CalcKr;
import jscinttools.scint.models.CalcKnr;

/**
 *  Description of the Class
 *
 *@author     marc-antoine
 *@created    16 février 2011
 */
public class CalcParameters implements Serializable
{
	private double tau_us = 0;

	private double tauAg_us = 0;

	private double ly = 0;

	private double lyAg = 0;

	private double lyTot = 0;


	/**
	 *  Constructor for the CalcParameters object
	 */
	public CalcParameters() { }



	/**
	 *  Constructor for the CalcParameters object
	 *
	 *@param  model   Description of the Parameter
	 *@param  temp_K  Description of the Parameter
	 */
	public CalcParameters(ScintDecayModels model, double temp_K)
	{
		double kr_MHz = new CalcKr(model.getK1_us(), model.getK2_us(), model.getD_K(), temp_K).getKr_MHz();
		double knr_MHz = new CalcKnr(model.getD_K(), model.getCapK_us(), model.getDeltaE_K(), temp_K).getKnr_MHz();
		double kag_MHz = new CalcKag(model.getKag1_us(), model.getKag2_us(), model.getDag_K(), model.getCapKag_us(), model.getDeltaEag_K(), temp_K).getKag_MHz();
		double n1 = model.getN1();
		double n3 = model.getN3();
		tau_us = 1.0 / (kr_MHz + knr_MHz);
		tauAg_us = 1.0 / kag_MHz;
		ly = n1 * kr_MHz / (kr_MHz + knr_MHz);
		lyAg = n3 * kr_MHz / kag_MHz;
		lyTot = ly - lyAg;
	}


	/**
	 *  Gets the tau_us attribute of the CalcParameters object
	 *
	 *@return    The tau_us value
	 */
	public double getTau_us()
	{
		return tau_us;
	}


	/**
	 *  Sets the tau_us attribute of the CalcParameters object
	 *
	 *@param  tau_us  The new tau_us value
	 */
	public void setTau_us(double tau_us)
	{
		this.tau_us = tau_us;
	}


	/**
	 *  Gets the tauAg_us attribute of the CalcParameters object
	 *
	 *@return    The tauAg_us value
	 */
	public double getTauAg_us()
	{
		return tauAg_us;
	}


	/**
	 *  Sets the tauAg_us attribute of the CalcParameters object
	 *
	 *@param  tauAg_us  The new tauAg_us value
	 */
	public void setTauAg_us(double tauAg_us)
	{
		this.tauAg_us = tauAg_us;
	}


	/**
	 *  Gets the ly attribute of the CalcParameters object
	 *
	 *@return    The ly value
	 */
	public double getLy()
	{
		return ly;
	}


	/**
	 *  Sets the ly attribute of the CalcParameters object
	 *
	 *@param  ly  The new ly value
	 */
	public void setLy(double ly)
	{
		this.ly = ly;
	}


	/**
	 *  Gets the lyAg attribute of the CalcParameters object
	 *
	 *@return    The lyAg value
	 */
	public double getLyAg()
	{
		return lyAg;
	}


	/**
	 *  Sets the lyAg attribute of the CalcParameters object
	 *
	 *@param  lyAg  The new lyAg value
	 */
	public void setLyAg(double lyAg)
	{
		this.lyAg = lyAg;
	}


	/**
	 *  Gets the lyTot attribute of the CalcParameters object
	 *
	 *@return    The lyTot value
	 */
	public double getLyTot()
	{
		return lyTot;
	}


	/**
	 *  Sets the lyTot attribute of the CalcParameters object
	 *
	 *@param  lyTot  The new lyTot value
	 */
	public void setLyTot(double lyTot)
	{
		this.lyTot = lyTot;
	}
}

